﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace Catering.DisplayBoards
{
    public partial class Pro_Service : System.Web.UI.Page
    {
        Catering_Rules.ClassInfo tClassInfo = new Catering_Rules.ClassInfo();//班组管理
        Catering_Rules.BanzuDynamic tBanzuDynamic = new Catering_Rules.BanzuDynamic();//班组动态
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.RepDataBind();
            }
        }
        public void RepDataBind()
        {
            DateTime SearchDateTime = DateTime.Today.AddDays(-1);
            if (Request.QueryString["Date"] != null)
            {
                SearchDateTime = Convert.ToDateTime(Request.QueryString["Date"]);
            }

            DataTable dt_BanzuDynamic = tBanzuDynamic.GetList("savedate = '" + SearchDateTime + "'","").Tables[0];
            dt_BanzuDynamic.Columns.Add("className");
            dt_BanzuDynamic.Columns.Add("tmpId");
            for (int i = 0; i < dt_BanzuDynamic.Rows.Count; i++)
            {
                try
                {
                    dt_BanzuDynamic.Rows[i]["tmpId"] = i + 1;
                    if (!String.IsNullOrEmpty(dt_BanzuDynamic.Rows[i]["ClassID"].ToString()))
                    {
                        dt_BanzuDynamic.Rows[i]["className"] = tClassInfo.GetModel(int.Parse(dt_BanzuDynamic.Rows[i]["ClassID"].ToString())).CName;
                    }
                }
                catch
                {
                    continue;
                }
            }
            this.Rep_BanzuDynamic.DataSource = dt_BanzuDynamic;
            this.Rep_BanzuDynamic.DataBind();
        }
        protected void Btn_Ref_Click(object sender, EventArgs e)
        {
            this.RepDataBind();
        }
    }
}